#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys

oracles = {
    "duplicates_sender_duplicate_min": [ ["(∃"] ],
    "duplicates_mixer_duplicate_min": [ ["(∃"] ],
    "default": [ ["!Sender"]
               , ["!Mixer"]
               , ["!BB( ~sid, S(S(S("]
               , ["!BB( ~sid, S(S("]
               , ["!BB( ~sid, S("]
               , ["Submit"]
               , ["Post"]
               , ["Mix"]
               , ["!BB("]
               , ["BBPost("]
               , ["#"] ]
}

lines = sys.stdin.readlines()
lemma = sys.argv[1]
oracle = oracles[lemma] if lemma in oracles else oracles["default"]

results = []
for current in oracle:
    for line in list(lines):
        for guess in current:
            if line.split(":")[1].strip().startswith(guess):
                num = line.split(":")[0]
                results.append(num)
                lines.remove(line)
                break

for num in results:
    print(num)